<?php
// +----------------------------------------------------------------------
// | Copyright (c) 2020 All rights reserved.
// +----------------------------------------------------------------------
// | User: Simony <1362229026@qq.com>
// | wechat: Shen86579595
// +----------------------------------------------------------------------

namespace app\common\model\message;

use app\common\model\Base;

use think\db;

class Message extends Base
{
    protected $name = 'message';

    /**
     * User: Simony
     * Function:添加消息
     * @param $member_id  发帖会员：-1代表系统用户
     * @param $receive_member_id 接收会员：-1代表给所有用户发送消息
     * @param $relation_member_id 关联用户
     * @param $type 消息类型：0系统消息 1评价通知
     * @param $content content
     * @return int|string
     *
     */
    public function addMessage($member_id, $receive_member_id, $relation_member_id, $type, $content)
    {
        $add_data = [
            'member_id' => $member_id,
            'receive_member_id' => $receive_member_id,
            'relation_member_id' => $relation_member_id,
            'type' => $type,
            'content' => $content,
            'create_time' => time()
        ];
        return $this->add($add_data);
    }
}
